<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <meta http-equiv="Pragma" content="no-cache">
    <meta http-equiv="Cache" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-cache, must-revalidate">
    <meta http-equiv="expires" content="0">
    <title>中奖名单</title>
    <link rel="stylesheet" href="css/reset.css">
    <link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="bootstrap/css/bootstrap-theme.min.css">
    <link rel="stylesheet" href="css/index.css">
    <style>
        #history_detail>ul>li{border-top: 5px solid #ddd;}
        #history_detail>ul>li:first-child{border-top: none;}
        th{text-align: center;}
    </style>
</head>
<body>
<div style="padding-top: 10px;" id="history_detail">
    <ul>
<!--        <li>-->
<!--            <div class="act_div">-->
<!--                <div>-->
<!--                    <img src="img/tmp/首页商品.png" alt="">-->
<!--                </div>-->
<!--                <div class="act_detail">-->
<!--                    <p><span>第C19期</span><span>8月30日开奖</span></p>-->
<!--                    <span></span>-->
<!--                    <p>iPhone6s黑色黑色黑色黑色黑色黑色黑色</p>-->
<!--                    <p><span>市场价:4990.00元</span><span>数量：1</span></p>-->
<!--                </div>-->
<!--            </div>-->
<!--            <div class="users container">-->
<!--                <p>中奖名单</p>-->
<!--                <table class="table table-striped">-->
<!--                    <tr>-->
<!--                        <th>#</th>-->
<!--                        <th>微信昵称</th>-->
<!--                        <th>参与时间</th>-->
<!--                    </tr>-->
<!--                    <tr>-->
<!--                        <td><img src="img/tmp/首页商品.png" alt="" /></td>-->
<!--                        <td>小黑</td>-->
<!--                        <td>2019-10-08 10:00:00</td>-->
<!--                    </tr>-->
<!--                    <tr>-->
<!--                        <td><img src="img/tmp/首页商品.png" alt="" /></td>-->
<!--                        <td>小黑</td>-->
<!--                        <td>2019-10-08 10:00:00</td>-->
<!--                    </tr>-->
<!--                    <tr>-->
<!--                        <td><img src="img/tmp/首页商品.png" alt="" /></td>-->
<!--                        <td>小黑</td>-->
<!--                        <td>2019-10-08 10:00:00</td>-->
<!--                    </tr>-->
<!--                </table>-->
<!--            </div>-->
<!--        </li>-->
    </ul>
</div>
<script src="js/jquery.js"></script>
<script src="bootstrap/js/bootstrap.min.js"></script>
<script src="https://res.wx.qq.com/open/js/jweixin-1.4.0.js"></script>
<script src="js/sha1.js"></script>
<script src="js/config.js"></script>
<script src="js/public2.js"></script>
<script type="text/javascript">
    let data = [];
    function afterVerify() {
        //加载接口
        $.post(baseUrl+'client/history',{},function(result){
            if(result.code === 0){
                data = result.data;
                let html = '';
                if(data.length === 0){
                    html = '<li>暂无数据</li>';
                }else{
                    for (let i = 0; i<data.length; i++) {
                        html += '<li><div class="act_div">';
                        html += '<div><img src="' + data[i].goods_imgs[0] +'" alt=""></div>';
                        html += '<div class="act_detail">';
                        html += '<p><span>第'+ data[i].act_no +'期</span><span>'+ data[i].draw_time +'开奖</span></p>';
                        html += '<span></span>';
                        html += '<p>'+ data[i].goods_name +'</p>';
                        html += '<p><span>市场价:'+ data[i].price +'</span><span>数量：'+ data[i].number +'</span></p>';
                        html += '</div></div>';
                        if(data[i].winner.length){
                            //中奖名单
                            html += '<div class="users container"><table class="table table-striped  table-hover table-condensed table-bordered" style="text-align: center;">';
                            html += '<tr><th style="width: 40px;">头像</th><th>微信昵称</th><th>中奖号码</th></tr>';
                            for (let j = 0; j<data[i].winner.length; j++) {
                                html += '<tr>';
                                html += '<td><img src="' + data[i].winner[j].headimgurl + '" alt=""></td>';
                                html += '<td>' + data[i].winner[j].nickname + '</td>';
                                html += '<td>' + data[i].winner[j].code + '</td>';
                                html += '</tr>';
                            }
                            html += '</table></div>';
                        }else{
                            html += '<p style="text-align: center;" class="text-danger">本次抽奖无人参与</p>'
                        }
                        html += '</li>';
                    }
                }
                $('#history_detail>ul').html(html);
            }else{
                alert(result.msg);
            }
        },'json');
    }
    //点击详情
    $('#history_detail').on("click",'li',function(){
        let index = $(this).index();
        let act_id = data[index].act_id;
        location.href = './detail.html?act_id='+act_id;
    });
</script>
<script src="js/verify.js"></script>
</body>
</html>
